package ma.mindware.mpm.util;

import java.util.Properties;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import ma.mindware.met.core.technicalservice.ServiceRunner;

public class Connecter {
	
	private HttpSession session ;

	private  Object[] serviceParameters;
	private  ServiceRunner serviceRunner;
	private  Properties config ;

	

	private  Properties getConfig(){
		
		session =ServletActionContext.getRequest().getSession();
		Properties config=((Properties)session.getServletContext().getAttribute("config"));
		return config;
	}
	
	public   ServiceRunner getDBServiceRunner(){
		serviceParameters=new Object[1];
		config=getConfig();
		serviceParameters[0]=config.getProperty("dbInfoFilePath");
		serviceRunner=ServiceRunner.getInstance();
		return serviceRunner;
	}

	public HttpSession getSession() {
		session =ServletActionContext.getRequest().getSession();
		return session;
	}

	public void setSession(HttpSession session) {
		this.session = session;
	}

	public Object[] getServiceParameters() {
		return serviceParameters;
	}

	public void setServiceParameters(Object[] serviceParameters) {
		this.serviceParameters = serviceParameters;
	}

	public ServiceRunner getServiceRunner() {
		return serviceRunner;
	}

	public void setServiceRunner(ServiceRunner serviceRunner) {
		this.serviceRunner = serviceRunner;
	}

	public void setConfig(Properties config) {
		this.config = config;
	}
	
	
}
